package fr.nantes.guidetouristique;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.ext.SatelliteMenu;
import android.view.ext.SatelliteMenu.SateliteClickedListener;
import android.view.ext.SatelliteMenuItem;

public class MenuActivity extends Activity {
	/** Called when the activity is first created. */
	private Context context;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		context = this;
		setContentView(R.layout.main);

		SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.menu);
		menu.setExpandDuration(500);
		menu.setSatelliteDistance(300);
		menu.setMainImage(R.drawable.main);
		menu.setTotalSpacingDegree(90);
		menu.setCloseItemsOnClick(true);

		List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>();
		items.add(new SatelliteMenuItem(5, R.drawable.apropos));
		items.add(new SatelliteMenuItem(4, R.drawable.circuit));
		items.add(new SatelliteMenuItem(3, R.drawable.nature));
		items.add(new SatelliteMenuItem(2, R.drawable.transport));
		items.add(new SatelliteMenuItem(1, R.drawable.monument));

		menu.addItems(items);

		menu.setOnItemClickedListener(new SateliteClickedListener() {

			public void eventOccured(int id) {
				Intent intent = new Intent();

				switch (id) {
				case 1:
					intent.setClass(context, CultureTabActivity.class);
					startActivity(intent);
					break;
				case 2:
					intent.setClass(context, TransportTabActivity.class);
					startActivity(intent);
					break;					
				case 3:
					intent.setClass(context, ParcTabActivity.class);
					startActivity(intent);
					break;
				case 4:
					intent.setClass(context, CircuitTabActivity.class);
					startActivity(intent);
					break;
				}
			}
		});
	}
}